<?php

if(!defined('mySite')){
    exit(1);
}

define('PROTOCOL', strtolower(preg_replace('/\/[0-9]+.?[0-9]*/', '', $_SERVER['SERVER_PROTOCOL'])) . '://');
define('SERVER', $_SERVER['SERVER_NAME']);

set_include_path(get_include_path() . PATH_SEPARATOR . INSTALLDIR.'/libs/');

require_once('PEAR.php');
require_once('DB/DataObject.php');
require_once('Validate.php');
require_once('Mail.php');

require_once(INSTALLDIR.'/include/basicconfig.php');
require_once(INSTALLDIR.'/config.php');

$myLib_path = INSTALLDIR.'/myLib';

if( is_dir($myLib_path) && ($myLib = opendir($myLib_path)) ) {
    while(false !== ($file = readdir($myLib))) {
        $lib_file = $myLib_path . '/' . $file;
        if( is_file($lib_file) && preg_match('/\.php$/', $file) && ($file != '.') && ($file != '..') ) {
            require_once($lib_file);
        }
    }
}

function __autoload($class) {
    if(file_exists('db_classes/'.$class.'.php')) {
        require_once('db_classes/'.$class.'.php');
    }
}

?>
